﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class download : System.Web.UI.Page
{
    //download.aspx?in=hinh-thoi-trang/album-hinh-yeu-thich-hp.gif
    protected void Page_Load(object sender, EventArgs e)
    {
        // Identify the file to download including its path.
        string filepath = Request["in"];

        // Identify the file name.
        string filename = System.IO.Path.GetFileName(filepath);

        Response.Clear();

        // Specify the Type of the downloadable file.
        Response.ContentType = "application/octet-stream";

        // Set the Default file name in the FileDownload dialog box.
        Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);

        Response.Flush();

        // Download the file.
        Response.WriteFile(filepath);
    }
}
